//
//  STMConfirmCaptchaViewController.m
//  StoreManagement
//
//  Created by centling on 16/6/2.
//  Copyright © 2016年 alfred. All rights reserved.
//

#import "STMConfirmCaptchaViewController.h"
#import "STMSetNewPwdViewController.h"

@interface STMConfirmCaptchaViewController ()
@property (weak, nonatomic) IBOutlet UITextField *captchaTextField;
@property (weak, nonatomic) IBOutlet UIButton *backButton;
@property (weak, nonatomic) IBOutlet UIButton *nextButton;

@end

@implementation STMConfirmCaptchaViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = MAINGRAYCOLOR;
    [self.backButton addTarget:self action:@selector(backButtonClick) forControlEvents:UIControlEventTouchUpInside];
    [self.nextButton addTarget:self action:@selector(nextButtonClick) forControlEvents:UIControlEventTouchUpInside];
}

- (void)backButtonClick {
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)nextButtonClick {
    if ([self.captchaTextField.text isEqualToString:@""]) {
        [GlobalUtil HUDShowMessage:@"请输入验证码" addedToView:self.view];
        return;
    }
    if ([self.captchaTextField.text isEqualToString:[UserDefaultHandler getUserDetaultString:kMobileCaptcha]]) {
        STMSetNewPwdViewController *setNewPwdVC = [[STMSetNewPwdViewController alloc] init];
        [self presentViewController:setNewPwdVC animated:YES completion:nil];
    } else {
        [GlobalUtil HUDShowMessage:@"验证码输入错误" addedToView:self.view];
    }
    
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
